﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.Party.PartyTemplateObject
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System;
using System.Collections.Generic;
using System.Xml;
using TaleWorlds.Library;
using TaleWorlds.ObjectSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.Party
{
  public sealed class PartyTemplateObject : MBObjectBase
  {
    public MBList<PartyTemplateStack> Stacks;

    internal static void AutoGeneratedStaticCollectObjectsPartyTemplateObject(
      object o,
      List<object> collectedObjects)
    {
      ((MBObjectBase) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      base.AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    public override void Deserialize(MBObjectManager objectManager, XmlNode node)
    {
      this.Stacks = new MBList<PartyTemplateStack>();
      base.Deserialize(objectManager, node);
      foreach (XmlNode childNode1 in node.ChildNodes)
      {
        if (childNode1.Name == "stacks")
        {
          foreach (XmlNode childNode2 in childNode1.ChildNodes)
          {
            if (childNode2.Name == "PartyTemplateStack")
              this.Stacks.Add(new PartyTemplateStack((CharacterObject) objectManager.ReadObjectReferenceFromXml("troop", typeof (CharacterObject), childNode2), Convert.ToInt32(childNode2.Attributes["min_value"].Value), Convert.ToInt32(childNode2.Attributes["max_value"].Value)));
          }
        }
      }
    }
  }
}
